package top.wyloop.intoeins.module.iam.model.form;

import lombok.Data;
import top.wyloop.intoeins.module.iam.model.entity.Permission;

import java.util.Date;

/**
 * @author Wyatt6
 * @date 2025/2/11
 */
@Data
public class PermissionForm {
    private Long id;                // 主键
    private String module;          // 模块分组
    private String identifier;      // 标识符
    private String name;            // 名称
    private Boolean activated;      // 启用/禁用
    private Date createTime;        // 创建时间
    private String remark;          // 备注

    public Permission convert() {
        Permission result = new Permission();

        result.setId(id);
        result.setModule(module != null ? module.trim() : null);
        result.setIdentifier(identifier != null ? identifier.trim() : null);
        result.setName(name != null ? name.trim() : null);
        result.setActivated(activated);
        result.setCreateTime(createTime);
        result.setRemark(remark != null ? remark.trim() : null);

        return result;
    }
}
